package com.cloud.code.dynaproxy;

/**
 * 动态代理主要使用到了jdk中的  InvocationHandler  ， Proxy 两个类， 是针对接口来实现方法的增强
 */
public class Test {

    public static void main(String[] args) {

        ShopProxy shopProxy = new ShopProxy();
        Shop taoBao = (Shop) shopProxy.newProxyInstance(new TaoBao());

        taoBao.shopping("xiaoming");
        taoBao.pay(100);


        Goods goods = (Goods) shopProxy.newProxyInstance(new TaoBao());
        goods.addGoods(200);
    }
}
